import 'package:enterprise_v6_app/app/components/custom_modele/custom_row_title.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/ext.dart';
import 'package:enterprise_v6_app/app/core/utils/file_util.dart';
import 'package:enterprise_v6_app/app/modules/application/education/train_program/offline_training/fill_in_train_result/fill_in_train_result_controller.dart';

///填写培训结果
class FillInTrainResultPage extends StatelessWidget {
  FillInTrainResultPage({super.key});

  final controller = Get.put(FillInTrainResultController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Container(
            margin: EdgeInsets.only(left: 16.w, top: 12.w, right: 16.w, bottom: 12.w),
            padding: EdgeInsets.only(left: 12.w, top: 14.w, right: 12.w, bottom: 14.w),
            decoration: const BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(Radius.circular(10)),
            ),
            child: Column(
              children: [
                CustomRowTitle(
                  isRequired: true,
                  title: '培训合格人数：',
                  content: '${controller.data?.numberOfQualifiedPersonnel ?? ''}',
                ),
                CustomRowTitle(
                  isRequired: true,
                  title: '培训不合格人数：',
                  content: '${controller.data?.numberOfUnqualifiedPersonnel ?? ''}',
                ),
                CustomRowTitle(
                  isRequired: true,
                  title: '考核人：',
                  content: controller.data?.assessorName ?? '',
                ),
                CustomRowTitle(
                  isRequired: true,
                  title: '考核日期：',
                  content: controller.data?.assessorDate ?? '',
                ),
                CustomRowTitle(
                  isRequired: true,
                  title: '培训学时：',
                  content: '${controller.data?.trainingHours ?? ''}',
                ),
                CustomRowTitle(
                  contentColor: const Color(0xFF5C6DFF),
                  isRequired: true,
                  title: '培训过程附件：',
                  content: controller.data?.processAttachments ?? '',
                ).clickOnce(() {
                  FileUtils.openFile(controller.data?.processAttachments ?? '', title: '文件名称');
                }),
                CustomRowTitle(
                  contentColor: const Color(0xFF5C6DFF),
                  isRequired: true,
                  title: '考试评分附件：',
                  content: controller.data?.ratingAttachment ?? '',
                ).clickOnce(() {
                  FileUtils.openFile(controller.data?.ratingAttachment ?? '', title: '文件名称');
                }),
              ],
            ),
          );
        });
  }
}
